package cn.wolfcode.web.interceptor;

import cn.wolfcode.domain.Employee;
import cn.wolfcode.domain.Menu;
import cn.wolfcode.service.IEmployeeService;
import cn.wolfcode.service.IMenuService;
import cn.wolfcode.utils.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.List;

public class CheckLoginInterceptor implements HandlerInterceptor {
    @Autowired
    private IMenuService menuService;
    @Autowired
    private IEmployeeService employeeService;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {


        if (UserContext.getEmployee() ==null) {
            response.sendRedirect("/static/login.html");
            return false ;
        }
        return true;
    }
}
